package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name="SALES")
public class Sales {
    private long salesId;
    private String salesTheme;
    private Date salesSignDate;
    private Long salesMoney;
    private Long salesPoss;
    private String salesStage;
    private String salesStatus;
    private String salesPlan;
    private Date salesUpDate;
    private Date salesDate;
    private String salesDemand;
    private String salesRemark;
    private String salesCode;
    private Customer customer;
    private List<Cart> cartList;
    private  Contract contract;
    private Linkman linkman;

    @ManyToOne
    @JoinColumn(name = "link_id", referencedColumnName = "link_id")
    public Linkman getLinkman() {
        return linkman;
    }

    public void setLinkman(Linkman linkman) {
        this.linkman = linkman;
    }

    @OneToOne //JPA注释： 一对一 关系
    @JoinColumn(name="contract_id" )// 在pepole中，添加一个外键 "pet_fk"
    public Contract getContract() {
        return contract;
    }

    public void setContract(Contract contract) {
        this.contract = contract;
    }

    @OneToMany(mappedBy = "sales")
    public List<Cart> getCartList() {
        return cartList;
    }

    public void setCartList(List<Cart> cartList) {
        this.cartList = cartList;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    @Id
    @Column(name = "sales_id2")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getSalesId() {
        return salesId;
    }

    public void setSalesId(long salesId) {
        this.salesId = salesId;
    }

    @Basic
    @Column(name = "sales_theme")
    public String getSalesTheme() {
        return salesTheme;
    }

    public void setSalesTheme(String salesTheme) {
        this.salesTheme = salesTheme;
    }

    @Basic
    @Column(name = "sales_sign_Date")
    public Date getSalesSignDate() {
        return salesSignDate;
    }

    public void setSalesSignDate(Date salesSignDate) {
        this.salesSignDate = salesSignDate;
    }

    @Basic
    @Column(name = "sales_money")
    public Long getSalesMoney() {
        return salesMoney;
    }

    public void setSalesMoney(Long salesMoney) {
        this.salesMoney = salesMoney;
    }

    @Basic
    @Column(name = "sales_poss")
    public Long getSalesPoss() {
        return salesPoss;
    }

    public void setSalesPoss(Long salesPoss) {
        this.salesPoss = salesPoss;
    }

    @Basic
    @Column(name = "sales_stage")
    public String getSalesStage() {
        return salesStage;
    }

    public void setSalesStage(String salesStage) {
        this.salesStage = salesStage;
    }

    @Basic
    @Column(name = "SALES_STATUS")
    public String getSalesStatus() {
        return salesStatus;
    }

    public void setSalesStatus(String salesStatus) {
        this.salesStatus = salesStatus;
    }

    @Basic
    @Column(name = "sales_plan")
    public String getSalesPlan() {
        return salesPlan;
    }

    public void setSalesPlan(String salesPlan) {
        this.salesPlan = salesPlan;
    }

    @Basic
    @Column(name = "sales_up_Date")
    public Date getSalesUpDate() {
        return salesUpDate;
    }

    public void setSalesUpDate(Date salesUpDate) {
        this.salesUpDate = salesUpDate;
    }

    @Basic
    @Column(name = "sales_date")
    public Date getSalesDate() {
        return salesDate;
    }

    public void setSalesDate(Date salesDate) {
        this.salesDate = salesDate;
    }

    @Basic
    @Column(name = "sales_demand")
    public String getSalesDemand() {
        return salesDemand;
    }

    public void setSalesDemand(String salesDemand) {
        this.salesDemand = salesDemand;
    }

    @Basic
    @Column(name = "sales_remark")
    public String getSalesRemark() {
        return salesRemark;
    }

    public void setSalesRemark(String salesRemark) {
        this.salesRemark = salesRemark;
    }

    @Basic
    @Column(name = "sales_code")
    public String getSalesCode() {
        return salesCode;
    }

    public void setSalesCode(String salesCode) {
        this.salesCode = salesCode;
    }

    @Override
    public String toString() {
        return "Sales{" +
                "salesId=" + salesId +
                ", salesTheme='" + salesTheme + '\'' +
                ", salesSignDate=" + salesSignDate +
                ", salesMoney=" + salesMoney +
                ", salesPoss='" + salesPoss + '\'' +
                ", salesStage='" + salesStage + '\'' +
                ", salesStatus='" + salesStatus + '\'' +
                ", salesPlan='" + salesPlan + '\'' +
                ", salesUpDate=" + salesUpDate +
                ", salesDate=" + salesDate +
                ", salesDemand='" + salesDemand + '\'' +
                ", salesRemark='" + salesRemark + '\'' +
                ", salesCode='" + salesCode + '\'' +
                '}';

    }
}
